﻿using System.Web;
using VideoSeller.Business.Data;
using VideoSeller.Business.Models;
using VideoSeller.Core.Configuration;
using System;

namespace VideoSeller.Web.Models
{
    public class BaseViewModel
    {
        
        
		public MembershipUser CurrentMembershipUser
		{
			get
			{
				if (HttpContext.Current.User != null && HttpContext.Current.User.Identity.IsAuthenticated)
				{
					var membershipUserModel = IoC.Resolve<MembershipUserModel>();
					return membershipUserModel.GetMembershipUser(HttpContext.Current.User.Identity.Name);
				}

				return null;
			}
		}
        public Guid CurrentUserId
        {
            get
            {
                if (CurrentMembershipUser != null)
                {
                    return CurrentMembershipUser.UserId;
                }

                return ClientModel.anonimeGuid;
            }
        }

        public string CurrentSessionId
        {
            get { return HttpContext.Current.Session.SessionID; }
        }

    }
}